<script lang="ts" setup>
const {safeAreaInsets} = uni.getSystemInfoSync()
withDefaults(defineProps<{
  // 导航栏标题
  title: string
  // 是否显示返回按钮
  showBack?: boolean
}>(), {
  showBack: true,
})
// 返回
const goBack = () => uni.navigateBack()
</script>

<template>
  <view :style="{ paddingTop: safeAreaInsets?.top+ 'px'}" style="background-color:#f1f1f1;">
    <view class="nav">
      <text v-show="showBack" class="cuIcon-roundleftfill-copy margin-right-xs line-awGreen"
            style="font-size: 44rpx" @click="goBack"></text>
      <view class="basis-lg text-xl margin-left-sm">{{ title }}</view>
      <slot name="nav-right">

      </slot>
    </view>
  </view>
</template>

<style lang="scss" scoped>
.nav {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0 30rpx;
  height: 50px;
  font-size: 32rpx;
  color: #333;
  border-bottom: #dbdbdb 1rpx solid;
}
</style>